<%--
  Created by IntelliJ IDEA.
  User: 86917
  Date: 2020/10/29
  Time: 15:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<%@include file="../layout/header.jsp" %>
<%@include file="../layout/script.jsp" %>
<head>
    <title>Title</title>
    <style>
        .table tbody tr.active {
            background: skyblue;
        }
        #syy.disabled,
        #xyy.disabled {
            color: #ccc;
            pointer-events: none;
        }
    </style>
</head>
<script type="text/javascript">
    function chaxun(){
        var gName = $("#gName").val();
        var url="${pageContext.request.contextPath}/arc_roll/listAll?rId=${mapData.get("rId")}&gName="+gName;
        window.location.href=url;
    }
    function syy(){
        //得到input的值
        var gName = $("#gName").val();
        var pageNo=${pageInfo.pageNum}-1;
        if(pageNo<${pageInfo.pages}){
            pageNo=1;
        }
        var url="${pageContext.request.contextPath}/arc_roll/listAll?pageNo="+pageNo+"rId=${mapData.get("rId")}&gName="+gName;
        window.location.href=url;
        judgePageBtnState(pageNo)
    }

    function xyy(){
        //得到input的值
        var gName = $("#gName").val();
        var pageNo=${pageInfo.pageNum}+1;
        if(pageNo>${pageInfo.pages}){
            pageNo=${pageInfo.pages};
        }
        var url="${pageContext.request.contextPath}/arc_roll/listAll?pageNo="+pageNo+"rId=${mapData.get("rId")}&gName="+gName;
        window.location.href=url;
        judgePageBtnState(pageNo)
    }
    function judgePageBtnState(curPage) {
        var totalPages = ${pageInfo.pages}
        if (curPage == 1) {
            $('#syy').addClass('disabled').attr('disabled', true)
        } else {
            $('#syy').removeClass('disabled').attr('disabled', false)
        }
        if (curPage == totalPages) {
            $('#xyy').addClass('disabled').attr('disabled', true)
        } else {
            $('#xyy').removeClass('disabled').attr('disabled', false)
        }
    }
    judgePageBtnState(${pageInfo.pageNum} || 1)
</script>
<style>

</style>
<body id="arcbody">
<div id="arcfilediv">
    <table class="table table-bordered">
        <thead>
        <tr>
            <td hidden="hidden">id</td>
            <td>序号</td>
            <td>文件名</td>
            <td>缩略图</td>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${pageInfo.list}" var="record" varStatus="status">
            <tr>
                <td hidden="hidden">${record.id}</td>
                <td>${status.index + 1}</td>
                <td>${record.gName}</td>
                <td><img height='60' width='200' src=""></td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="28" style="text-align: right">
                共${pageInfo.pages}页,当前页${pageInfo.pageNum},
                <a id="syy" href="">上一页</a>,
                <a id="xyy" href="">下一页</a>
            </td>
        </tr>

        </tbody>
    </table>
</div>
</body>
</html>
